home *** CD-ROM | disk | FTP | other *** search
- Path: news.uni-stuttgart.de!schweikh
- From: schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt)
- Newsgroups: comp.lang.c
- Subject: Re: Segmentation Fault ???
- Date: 13 Mar 1996 09:37:20 GMT
- Organization: Comp.Center (RUS), U of Stuttgart, FRG
- Message-ID: <4i650g$oc8@info4.rus.uni-stuttgart.de>
- References: <4hsa7i$en3@wraith.its.uow.edu.au> <4huis1$cm2@ccshst05.cs.uoguelph.ca> <4hv75jINNpss@keats.ugrad.cs.ubc.ca> <4hvaq3$n8f@ccshst05.cs.uoguelph.ca>
- NNTP-Posting-Host: itosun.ito.uni-stuttgart.de
-
- In article <4hvaq3$n8f@ccshst05.cs.uoguelph.ca>,
- Toby K Hay <thay@uoguelph.ca> wrote:
-
- [snip]
-
- >From three replies I received via E-mail I understand that accessing
- >illegal memory is almost certainly caused by using uninitialized pointers
- >- something I will check my code for again. But what determines the
- >limits of my malloc heap, stack, and so forth? Can I request more memory
- >for these at the command line when I start the program?
-
- The limits in UNIX are determined by the available virtual memory.
- You can not request more resources per program. You also don't have
- to specify it at link time (how many stack space etc, like you
- may have to on DOS systems) or whenever.
- The address space of your program grows dynamically. Malloc
- will probably call sbrk() on UNIX to increase the heap.
- It will return NULL if the request can't be satisfied.
- So be sure to always *test* what malloc returns.
-
- As for the stack space, it'll also grow as needed,
- as long as there is virtual memory available. In case
- it's used up your program is likely to get a lethal signal.
- But unless your program is really pathological I bet
- you never see this happen. It didn't occur to me in 10 years
- of UNIX programming.
-
-
- There is however a limit on certain resources in UNIX,
- like maximum address space and file size. The SVR4 csh
- for example says
- schweikh@itosun:~/ftp> csh -c limit
- cputime unlimited
- filesize unlimited
- datasize 2097148 kbytes
- stacksize 8192 kbytes
- coredumpsize unlimited
- descriptors 64
- memorysize unlimited
-
- Try 'apropos limit' to see how you may list and alter your
- resource limits. Note that all this is UNIX specific and
- should have been asked in a newsgroup dedicated to UNIX.
-
- Bye, Jens
-
- --
- SIGSIG -- signature too long (core dumped)
-